﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Jb.Common.Extensions;
using Jb.Domain;
using Jb.Web.ViewModels;
using Jb.Web.Utility;
using AutoMapper;
using System.Data;
using Jb.Web.ViewModels.UtilityModels;

namespace Jb.Web.Controllers
{
    public class ContentController : BaseController
    {
		private JbEntities _Context = new JbEntities();
        
		#region Constructors
		public ContentController()
		{
		}

        public ContentController(UserViewModel currentUser)
			: base(currentUser)
        {
        }
		#endregion Constructors

		#region Action Methods

        /// <summary>
        /// Shows Details of a Content
        /// </summary>
        /// <param name="contentUrl"></param>
        /// <returns></returns>
        public ActionResult Details(String contentUrl)
        {
            Content entity = _Context.Contents.FirstOrDefault(P => P.Url == contentUrl);
            ContentViewModel viewModel = Mapper.Map<Content, ContentViewModel>(entity);
            return View(viewModel);
        }
		
		#endregion Action Methods
		
		#region Helper Methods

        #endregion			
    }
}
